package com.example.service;

import com.example.entity.Advertisement;
import com.example.mapper.AdvertisementMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


// AdvertisementService.java
@Service
public class AdvertisementService {
    @Resource
    private AdvertisementMapper advertisementMapper;

    public Advertisement getLatest() {
        return advertisementMapper.selectLatest();
    }

    @Transactional
    public void update(Advertisement ad) {
        advertisementMapper.update(ad);
    }
}